<div style="clear: both;">
    <?php echo CHtml::beginForm('', 'post', array('class' => 'dot_form fw_60', 'enctype'=>'multipart/form-data')); ?>
    <fieldset>
        <legend><?php echo Yii::t('common', 'please_fill_table_contents'); ?></legend>
        <dl>
            <dt><?php echo CHtml::activeLabel($category, 'parent_id'); ?></dt>
            <dd>
                <div>
                    <?php
                    require_once(Yii::app()->basePath . '/extensions/GraphTree/tree.php');
                    $book_id = Yii::app()->request->getParam('bid', 0);
                    $datas = BookChapterCategory::model()->getCTreeViewDatas($book_id);
                    if (count($datas)) {
                        $datas = dumpArrayTree($datas);
                    }
                    $trees = array('0' => 'ΞΞ CATEGORY ROOT ΞΞ');
                    if (count($datas)) {
                        foreach ($datas as $data) {
                            $trees[$data['id']] = $data['levelstr'] . '⇒ ' . strip_tags($data['text']) . '《' . (string)$data['order_pos'] . '》';
                        }
                    }
                    echo CHtml::activeDropDownList($category, 'parent_id', $trees);
                    ?>
                </div>
            </dd>

            <dt><?php echo CHtml::activeLabelEx($category, 'title'); ?></dt>
            <dd>
                <div>
                <?php
                    echo CHtml::activeTextField($category, 'title', array(
                        'maxlength' => 200,
                        'class' => 'large',
                    ));
                ?>
                <?php echo CHtml::activeLabelEx($category, 'author'); ?>
                <?php echo CHtml::activeTextField($category, 'author'); ?>
                </div>
                <div>
                    <?php
                    echo CHtml::error($category, 'title') . CHtml::error($category, 'author');
                    ?>
                </div>
            </dd>

            <dt><?php echo CHtml::activeLabelEx($category, 'order_pos'); ?></dt>
            <dd>
                <div>
                    <?php echo CHtml::activeTextField($category, 'order_pos', array('class' => 'num')); ?>
                    <?php echo CHtml::activeLabelEx($category, 'status'); ?>
                    <?php echo CHtml::activeDropDownList($category, 'status', BookChapterCategory::model()->statusOptions); ?>
                </div>
                <div><?php echo CHtml::error($category, 'order_pos'); ?></div>
            </dd>            
            
            <dt><?php echo CHtml::activeLabelEx($category, 'summary'); ?></dt>
            <dd>
                <div style="width: 100%;">
                    <?php echo CHtml::activeTextArea($category, 'summary', array('style' => 'width: 100%; height: 300px;')); ?>
                </div>
                <div><?php echo CHtml::error($category, 'summary'); ?></div>
            </dd>

            <dt></dt>
            <dd>
                <?php
                echo CHtml::submitButton($category->isNewRecord
                    ? Yii::t('common', 'save') : Yii::t('common', 'update'), array(
                    'class' => 'btn'
                ));
                ?>
            </dd>
        </dl>
    </fieldset>
    <?php echo CHtml::endForm(); ?>
</div>